<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('username')->comment("登录名");
            $table->string('password')->comment("密码");
            $table->string('name')->default('')->comment("用户名");
            $table->unsignedInteger('school_id')->comment("学校id")->nullable();
            $table->unsignedInteger('role_id')->comment("角色id")->nullable();
            $table->string('pic',100)->nullable()->default('')->comment("头像");
            $table->tinyInteger("sex")->nullable()->default(0)->comment("性别[男,女]");
            $table->tinyInteger("age")->nullable()->default(0)->comment("年龄");
            $table->tinyInteger("type")->nullable()->default(0)->comment("类型[学生,教师,管理员]");
            $table->string('email')->nullable();
            $table->string('phone',25)->nullable();
            $table->char('last_login_ip')->nullable()->comment("登陆ip");
            $table->dateTime('last_login_time')->nullable()->comment("登陆时间");
            $table->char('last_session')->nullable()->comment("登陆session");
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
